package com.twq.types.abstracttype

/**
 * Created by tangweiqun on 2017/11/21.
 */
object AbstractTypeTest1 {

}

// Type parameter version
trait Collection[T] {
  // ...
}

// Type member version
trait CollectionMember {
  type T
  // ...
}

// Type parameter version
trait StringCollection extends Collection[String] {
  // ...
}

// Type member version
trait StringCollectionMember extends CollectionMember {
  type T = String
  // ...
}

//---------------------------------------
// Type parameter version
trait FixtureSuite[F] {
  // ...
}

// Type member version
trait FixtureSuiteMember {
  type F
  // ...
}

// Type parameter version
class MySuite extends FixtureSuite[StringBuilder] {
  // ...
}

// Type member version
class MySuiteMember extends FixtureSuiteMember {
  type F = StringBuilder
  // ...
}

// Type parameter version
trait StringBuilderFixture {
  this: FixtureSuite[StringBuilder] =>
  // ...
}

// Type member version
trait StringBuilderFixtureMember {
  this: FixtureSuiteMember =>
  type F = StringBuilder
  // ...
}

// Type parameter version
class MySuiteOtherType extends FixtureSuite[StringBuilder] with StringBuilderFixture {
  // ...
}

// Type member version
class MySuiteOtherTypeMember extends FixtureSuiteMember with StringBuilderFixtureMember {
  // ...
}


//-----------------------------------------
trait FixtureSuite3[F, T, M] {
  // ...
}

trait StringBuilderFixture3 {
  this: FixtureSuite3[StringBuilder, StringBuilder, Int] =>
  // ...
}

// Type parameter version
class MySuiteManyTypes extends FixtureSuite3[StringBuilder, StringBuilder, Int] with StringBuilderFixture3 {
  // ...
}

trait FixtureSuite3Member {
  type F
  type T
  type M
  // ...
}

// Type member version
trait StringBuilderFixture3Member {
  this: FixtureSuite3Member =>
  type F = StringBuilder
  type T = StringBuilder
  type M = Int
  // ...
}

// Type member version
class MySuite3OtherTypeMember extends FixtureSuite3Member with StringBuilderFixture3Member {
  // ...
}

